package com.paishen.peiniwan.database;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.paishen.peiniwan.database.User;
import com.paishen.peiniwan.database.Coupon;
import com.paishen.peiniwan.database.Photo;
import com.paishen.peiniwan.database.AuthInfo;
import com.paishen.peiniwan.database.Gift;

import com.paishen.peiniwan.database.UserDao;
import com.paishen.peiniwan.database.CouponDao;
import com.paishen.peiniwan.database.PhotoDao;
import com.paishen.peiniwan.database.AuthInfoDao;
import com.paishen.peiniwan.database.GiftDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig userDaoConfig;
    private final DaoConfig couponDaoConfig;
    private final DaoConfig photoDaoConfig;
    private final DaoConfig authInfoDaoConfig;
    private final DaoConfig giftDaoConfig;

    private final UserDao userDao;
    private final CouponDao couponDao;
    private final PhotoDao photoDao;
    private final AuthInfoDao authInfoDao;
    private final GiftDao giftDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        couponDaoConfig = daoConfigMap.get(CouponDao.class).clone();
        couponDaoConfig.initIdentityScope(type);

        photoDaoConfig = daoConfigMap.get(PhotoDao.class).clone();
        photoDaoConfig.initIdentityScope(type);

        authInfoDaoConfig = daoConfigMap.get(AuthInfoDao.class).clone();
        authInfoDaoConfig.initIdentityScope(type);

        giftDaoConfig = daoConfigMap.get(GiftDao.class).clone();
        giftDaoConfig.initIdentityScope(type);

        userDao = new UserDao(userDaoConfig, this);
        couponDao = new CouponDao(couponDaoConfig, this);
        photoDao = new PhotoDao(photoDaoConfig, this);
        authInfoDao = new AuthInfoDao(authInfoDaoConfig, this);
        giftDao = new GiftDao(giftDaoConfig, this);

        registerDao(User.class, userDao);
        registerDao(Coupon.class, couponDao);
        registerDao(Photo.class, photoDao);
        registerDao(AuthInfo.class, authInfoDao);
        registerDao(Gift.class, giftDao);
    }
    
    public void clear() {
        userDaoConfig.getIdentityScope().clear();
        couponDaoConfig.getIdentityScope().clear();
        photoDaoConfig.getIdentityScope().clear();
        authInfoDaoConfig.getIdentityScope().clear();
        giftDaoConfig.getIdentityScope().clear();
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public CouponDao getCouponDao() {
        return couponDao;
    }

    public PhotoDao getPhotoDao() {
        return photoDao;
    }

    public AuthInfoDao getAuthInfoDao() {
        return authInfoDao;
    }

    public GiftDao getGiftDao() {
        return giftDao;
    }

}
